package gui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JPanel;

@SuppressWarnings("serial")
public class MyTasksPanel extends JPanel {
	private TasksListingPanel tasksListingPanel;

	public MyTasksPanel() {
		setEnvironment();

		JPanel tempPanel = new JPanel(new GridBagLayout());
		setTempPanelEnvironment(tempPanel);

		GridBagConstraints c = new GridBagConstraints();

		tasksListingPanel = new TasksListingPanel();
		c.fill = GridBagConstraints.HORIZONTAL;
		c.weightx = 0.5;
		c.gridx = 0;
		c.gridy = 0;
		tempPanel.add(tasksListingPanel, c);

		add(tempPanel, BorderLayout.CENTER);
	}

	private void setTempPanelEnvironment(JPanel tempPanel) {
		tempPanel.setSize(new Dimension(130, 100));
		tempPanel.setOpaque(false);
	}

	private void setEnvironment() {
		setSize(Dimensions._windowWidth, Dimensions._windowHeight);
		setLayout(new BorderLayout());
		setOpaque(false);
	}

	protected void updatePanel(String[][] tasks) {
		tasksListingPanel.updateTable(tasks);
	}

}
